<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%
    	Cookie[] cookies=request.getCookies();
    	String cookiecontent="";
    	for(int i=0;i<cookies.length;i++){
    		if(cookies[i].getName().equals("chkbox")){
    			cookiecontent=cookies[i].getValue();
    		}
    	}
     %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="servlet/Ch10Servlet4" method="post">
	<input type="checkbox" name="chkbox" value="option1" <%=cookiecontent.indexOf("option1")==-1?"":"checked" %>>option1
	<input type="checkbox" name="chkbox" value="option2" <%=cookiecontent.indexOf("option2")==-1?"":"checked" %>>option2
	<input type="checkbox" name="chkbox" value="option3" <%=cookiecontent.indexOf("option3")==-1?"":"checked" %>>option3<br/>
	<input type="submit">
</form>
</body>
</html>